/**
 * 
 */
package com.loser.csp.service.backmanager.impl;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.loser.csp.dal.dao.AdminMapper;
import com.loser.csp.dal.model.Admin;
import com.loser.csp.service.backmanager.AdminServices;

/**
 * @author alan
 *
 */
@Component("adminServices")
public class AdminServicesImpl implements AdminServices {
    private Logger      logger = LoggerFactory.getLogger(AdminServicesImpl.class);

    @Autowired
    private AdminMapper adminMapper;

    @Override
    public Admin backLogin(String loginName, String password) {
        Admin admin = adminMapper.selectByLoginNamePwd(loginName, password);
        logger.info("用户：" + admin);
        if (admin == null) {
            logger.info("后台登陆失败");
            return null;
        }       
        return admin;
    }

    @Override
    public int deleteById(Integer adminid) {

        return adminMapper.deleteById(adminid);
    }

    @Override
    public int insert(Admin admin) {
        return adminMapper.insert(admin);
    }

    @Override
    public Admin selectById(Integer adminid) {
        return adminMapper.selectById(adminid);
    }

    @Override
    public int updateByAdmin(Admin admin) {

        return adminMapper.updateByAdmin(admin);
    }

}
